import axios from "axios";
import {
    hotelOwner
} from '../../api/hotel'
import {
    createMyOrderApi,
    changeOrderApi
} from '../../api/mine'
export default {
    namespaced: true,
    state: {
        totalPrice: 0,
        orderId: 0
    },

    mutations: {
        setTotalPrice(state, list) {
            // const {datelength,peopleNum}=list
            // state.totalPrice = this.state.hoteldetail.hotelDetailData[0].price * datelength * peopleNum
            state.totalPrice =list
        },
        setOrderId(state, _id) {
            state.orderId = _id
        }

    },
    actions: {
        // 添加订单
        async createmyorder(context, list) {
            const {
                data
            } = await createMyOrderApi(list);
            //   console.log(data);
            context.commit('setOrderId', data.orderId)
        },

        //修改订单状态
        async changeOrderState(context, orederstate) {
            // console.log(context.state.orderId);
            const {
                data
            } = await changeOrderApi({...orederstate,orderId:context.state.orderId});
            // console.log(data);
        }



    }
}